package jxc.data.hibernate.dao;

import org.hibernate.Query;

import jxc.data.hibernate.pojo.Customer;

public class CustomerDAO extends HibernateBaseDAO<Customer> {

	public Customer getByName(String name){
		String hql="from Customer where customername=:name";
		Query query=session.createQuery(hql);
		query.setString("name", name);
		return (Customer) query.uniqueResult();
	}
	
	public Customer getById(String id){
		if(id==null)
			return null;
		return this.getById(Customer.class, id);
	}

	@SuppressWarnings("unchecked")
	public java.util.List<Customer> getAll() {
		String hql="from Customer";
		Query query=session.createQuery(hql);
		return  query.list();
	}

	public java.util.List<Customer> getLikeName(String name) {
		// TODO Auto-generated method stub
		return null;
	}
}
